package cn.openea.perpartner.componet.scheduledtasks.smsblacklist;

import cn.openea.perpartner.componet.web.service.ISmsBlacklistService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;

import javax.annotation.Resource;

/**
 * @author ysk
 * @version 1.0.1
 * @Description 短信黑名单同步redis缓存
 */
@Slf4j
@Component
public class SyncSmsBlacklistTask {

    @Resource
    private ISmsBlacklistService smsBlacklistService;

    /**
     * 同步业务状态
     * 每天凌晨3点执行 0 0 3 * * ?
     */
    @Scheduled(cron = "0 0 3 * * ?")
    public void smsBlacklistSyncRedis() {
        log.info("sms blacklist sync redis start execution");
        try {
            smsBlacklistService.cacheList();
        } catch (Exception e) {
            log.error("sms blacklist sync redis execution failed");
        }
    }

}
